package fun.chutianshu.competitionmanagement.service;

import fun.chutianshu.competitionmanagement.daomapper.UserInfoMapper;
import fun.chutianshu.competitionmanagement.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public List<UserInfo> getAllUserInfos() {
        return userInfoMapper.getAllUserInfo();
    }

    @Override
    public UserInfo getOneUserInfo(int userId) {
        return userInfoMapper.getUserInfo(userId);
    }

    @Override
    public int updateUserInfo(UserInfo userInfo) {
        return userInfoMapper.updateUserInfo(userInfo);
    }

    @Override
    public int addUserInfo(UserInfo userInfo) {
        return userInfoMapper.insertUserInfo(userInfo.getUserName(),userInfo.getUserPwd(),userInfo.getUserRole());
    }

    @Override
    public int delUserInfo(int userId) {
        return userInfoMapper.deleteUserInfo(userId);
    }
}
